#ifndef CLIENTPROTOCOL_H
#define CLIENTPROTOCOL_H
#include <QString>
#include "NetworkException.h"

#define UP 1
#define DOWN 2
#define LEFT 3
#define RIGHT 4

/*!
  Definition of the abstract client protocol
*/
class ClientProtocol
{
public:
        /*!
          Connects to the server
          @param[in] QString server ip
        */
	virtual void connect(QString) = 0;

        /*!
          Sending message to the server
          @param[in] command type
          @param[in] command parameters num
          @param[in] command parameters
        */
	virtual void sendToServer(int,int = 0 ,void* = NULL) = 0;

        /*!
          Checks if socket is open
          @return true if socket is opent, otherwise false
        */
	virtual bool isOpen() = 0;

        /*!
          Checks if connection is avalaible
          @return true if connected, otherwise false
        */
	virtual bool isConnected() = 0;

        /*!
          Receive command from the client
          @return command number
        */
	virtual int receive() = 0;

        /*!
          Receive connection data(for now char* robotname)
          @return robotname
        */
	virtual char* receiveConnect() = 0;

        /*!
          Closing the socket
        */
	virtual void close() = 0;
	
        /*!
           Initializing the server
        */
	virtual void initServer() = 0;

        /*!
          Receiving connections
          @return an instance of a connection
        */
	virtual ClientProtocol* acceptConnection() = 0;

        /*!
          TODO
        */
        virtual void sendToClient(int) = 0;

        /*!
          Sending the name of the robot to the server
          @param[in] the name of the robot
        */
	virtual void sendRobotName(const char*) = 0;

        /*!
          @return returns the parameter count of the last command
        */
	virtual int getParameterCount() = 0;

        /*!
          @return returns the parameters of the last command
        */
	virtual void* getParameters() = 0;
};

#endif
